using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Domains
{
    /// <summary>
    /// <para>Table To Domain</para>
    /// <para>Creates or updates a coded value domain with values from a table.</para>
    /// <para>使用表中的值创建或更新编码值域。</para>
    /// </summary>    
    [DisplayName("Table To Domain")]
    public class TableToDomain : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TableToDomain()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The database table from which to derive domain values.</para>
        /// <para>要从中派生域值的数据库表。</para>
        /// </param>
        /// <param name="_code_field">
        /// <para>Code Field</para>
        /// <para>The field in the database table from which to derive domain code values.</para>
        /// <para>数据库表中要从中派生域代码值的字段。</para>
        /// </param>
        /// <param name="_description_field">
        /// <para>Description Field</para>
        /// <para>The field in the database table from which to derive domain description values.</para>
        /// <para>数据库表中用于派生域描述值的字段。</para>
        /// </param>
        /// <param name="_in_workspace">
        /// <para>Input Workspace</para>
        /// <para>The workspace that contains the domain to be created or updated.</para>
        /// <para>包含要创建或更新的域的工作区。</para>
        /// </param>
        /// <param name="_domain_name">
        /// <para>Domain Name</para>
        /// <para>The name of the domain to be created or updated.</para>
        /// <para>要创建或更新的域的名称。</para>
        /// </param>
        public TableToDomain(object _in_table, object _code_field, object _description_field, object _in_workspace, object _domain_name)
        {
            this._in_table = _in_table;
            this._code_field = _code_field;
            this._description_field = _description_field;
            this._in_workspace = _in_workspace;
            this._domain_name = _domain_name;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Table To Domain";

        public override string CallName => "management.TableToDomain";

        public override List<string> AcceptEnvironments => ["autoCommit", "workspace"];

        public override object[] ParameterInfo => [_in_table, _code_field, _description_field, _in_workspace, _domain_name, _domain_description, _update_option.GetGPValue(), _out_workspace];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The database table from which to derive domain values.</para>
        /// <para>要从中派生域值的数据库表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Code Field</para>
        /// <para>The field in the database table from which to derive domain code values.</para>
        /// <para>数据库表中要从中派生域代码值的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Code Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _code_field { get; set; }


        /// <summary>
        /// <para>Description Field</para>
        /// <para>The field in the database table from which to derive domain description values.</para>
        /// <para>数据库表中用于派生域描述值的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Description Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _description_field { get; set; }


        /// <summary>
        /// <para>Input Workspace</para>
        /// <para>The workspace that contains the domain to be created or updated.</para>
        /// <para>包含要创建或更新的域的工作区。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Workspace")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_workspace { get; set; }


        /// <summary>
        /// <para>Domain Name</para>
        /// <para>The name of the domain to be created or updated.</para>
        /// <para>要创建或更新的域的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Domain Name")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _domain_name { get; set; }


        /// <summary>
        /// <para>Domain Description</para>
        /// <para>The description of the domain to be created or updated. Domain descriptions of existing domains are not updated.</para>
        /// <para>要创建或更新的域的说明。现有域的域描述不会更新。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Domain Description")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _domain_description { get; set; } = null;


        /// <summary>
        /// <para>Update Option</para>
        /// <para><xdoc>
        ///   <para>If the domain already exists, specifies how the domain will be updated.</para>
        ///   <bulletList>
        ///     <bullet_item>Append the values—Appends to the domain values from the database table.</bullet_item><para/>
        ///     <bullet_item>Replace the values—Replaces the values in the domain with values from the database table.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>如果域已存在，则指定域的更新方式。</para>
        ///   <bulletList>
        ///     <bullet_item>追加值 - 追加到数据库表中的属性域值。</bullet_item><para/>
        ///     <bullet_item>替换值 - 将属性域中的值替换为数据库表中的值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Update Option")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _update_option_value _update_option { get; set; } = _update_option_value._APPEND;

        public enum _update_option_value
        {
            /// <summary>
            /// <para>Append the values</para>
            /// <para>Append the values—Appends to the domain values from the database table.</para>
            /// <para>追加值 - 追加到数据库表中的属性域值。</para>
            /// </summary>
            [Description("Append the values")]
            [GPEnumValue("APPEND")]
            _APPEND,

            /// <summary>
            /// <para>Replace the values</para>
            /// <para>Replace the values—Replaces the values in the domain with values from the database table.</para>
            /// <para>替换值 - 将属性域中的值替换为数据库表中的值。</para>
            /// </summary>
            [Description("Replace the values")]
            [GPEnumValue("REPLACE")]
            _REPLACE,

        }

        /// <summary>
        /// <para>Updated Input Workspace</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Workspace")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_workspace { get; set; }


        public TableToDomain SetEnv(int? autoCommit = null, object workspace = null)
        {
            base.SetEnv(autoCommit: autoCommit, workspace: workspace);
            return this;
        }

    }

}